import { AxiosRequestConfig } from "axios"
import axiosInstance, { ApiResponse } from "./axiosInstance"

function get<T, P = any>(url: string, params: P): Promise<ApiResponse<T>> {
    return axiosInstance.get(url, { params })
}

const post = <T>(
    url: string,
    data: T,
    config?: AxiosRequestConfig<T>
): Promise<ApiResponse<T>> => {
    return axiosInstance.post(url, data as T, config)
}

export { get, post }
